﻿@model IEnumerable<Article>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    var category = new CategoryWrapper((Category)ViewData["Category"]);
    
}
<table style="width: 100%;">
    <tr>
        <td style="vertical-align: top; width: 700px; display: block;">
            <table style="width: 100%;">
                <tr>
                    <td>
                        <h1 style="overflow: hidden;" class="dna-post-title">
                            @if (!string.IsNullOrEmpty(category.ImageUrl))
                            {
                                <img src="@Url.Content(category.ImageUrl)"  alt="@category.Title" style="vertical-align: middle;"/>
                            }
                            <span>@category.Title</span>
                        </h1>
                        <div>@category.Description</div>
                    </td>
                    <td style="white-space: nowrap; text-align: right;">
                        <ul class="d-horizontal-list">
                            @if (Request.IsAuthenticated)
                            { 
                                <li>
                                    @UIHelper.SubscriptionLink(Ajax, category.PermaLink)
                                </li>
                            }
                            <li>
                                @Ajax.Dna().Link(Url.Action("rss", "Category", new { Area = "Publishing", id = category.ID })).Text("rss").ImageIcons(@Url.Content("~/Content/Images/rss.png")).GetHtml()
                            </li>
                            <li>
                                @Ajax.Dna().Link(Url.Action("atom", "Category", new { Area = "Publishing", id = category.ID })).Text("atom").ImageIcons(@Url.Content("~/Content/Images/rss.png")).GetHtml()
                            </li>
                        </ul>
                    </td>
                </tr>
            </table>
            @{
                Ajax.Dna().WidgetZone("Left top zone", "zone0")
                    .HtmlAttributes(new { style = "float: none; margin-bottom: 5px;overflow:auto;" })
                    .Content(@<text>
                @if (!string.IsNullOrEmpty(category.Description))
                {
                    <div>
                    @if (WebSiteContext.Current.Web.IsRoot)
                    { 
                        @MvcHtmlString.Create(HttpContext.Current.Server.HtmlDecode(category.Description))
                    }
                </div>
                }
                @{
                    Html.RenderPartial("_BlogSummaryList", Model);}

                @{
                    Ajax.Dna().Pager("postPager").HtmlAttributes(new { style = "padding:10px 0px;" }).Load(category.PermaLink).Render();
                    }
                </text>)
                   .Render();}
            <table style="width: 100%">
                <tr>
                    <td style="width: 50%; vertical-align: top;">
                        @{ Ajax.Dna().WidgetZone("Bottom left zone", "zone1")
                    .HtmlAttributes(new { style = "float: left; min-width: 330px;" })
                    .Render(); }
                    </td>
                    <td style="vertical-align: top;">
                        @{ Ajax.Dna().WidgetZone("Bottom right zone", "zone2")
                    .HtmlAttributes(new { style = "float: left; min-width: 330px;" })
                    .Render();}
                    </td>
                </tr>
            </table>
        </td>
        <td style="vertical-align: top;">
            @{ Ajax.Dna().WidgetZone("Right zone", "zone3").Render();}
        </td>
    </tr>
</table>
@Html.StartupScripts()
@section HeaderSection{
    <link rel="alternate" type="application/rss+xml" href="@Url.Action("RssFeed", "Category", new
                       {
                           Area = "Publishing",
                           website = WebSiteContext.Current.Web.Name,
                           id = category.ID
                       })" title="@category.Title Posts Feed" />
    <link rel="alternate" type="application/atom+xml" href="@Url.Action("AtomFeed", "Category", new
                       {
                           Area = "Publishing",
                           website = WebSiteContext.Current.Web.Name,
                           id = category.ID
                       })" title="@category.Title Posts Feed" />
}
